
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Rectangle.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Rectangle)
{
        TEST(should be able to calculate area : 2*3=6)
        {
                Rectangle rectangle(2, 3);
                ASSERT_EQ(6, rectangle.getArea());
        }

        TEST(should be able to calculate perimeter : (2+3)*2=10)
        {
                Rectangle rectangle(2, 3);
                ASSERT_EQ(10, rectangle.getPerimeter ());
        }

        TEST(should be able to calculate perimeter : (100.00+100.00)*2=400.00)
        {
                Rectangle rectangle(100.00, 100.00);
                ASSERT_EQ(400.00, rectangle.getPerimeter ());
        }

        TEST(should be able to construct rectangle : 100.02 * 0.01)
        {
                Rectangle rectangle(100.02, 0.01);
                ASSERT_EQ((float)(0.00), rectangle.getHeight());
                ASSERT_EQ((float)(0.01), rectangle.getWidth());
        }

        TEST(should be able to check input Height and width value, and keep the right one : 10.02 * -0.01)
        {
                Rectangle rectangle(10.02, -0.01);
                ASSERT_EQ(true, rectangle.setWidth(0.88));
                ASSERT_EQ(false, rectangle.setHeight(100.08));
                ASSERT_EQ((float)10.02, rectangle.getHeight());
                ASSERT_EQ((float)0.88, rectangle.getWidth());
        }

        TEST(should be able to keep the right precision : 10.022 * 0.016)
        {
                Rectangle rectangle(10.022, 0.016);
                ASSERT_EQ((float)10.02, rectangle.getHeight());
                ASSERT_EQ((float)0.01, rectangle.getWidth());
        }

};


